<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>行情</title>
    <base id="base" href="${basePath}">
    <script src="js/base.js"></script>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
    <script src="../js/trades/index.js"></script>
</head>
<style type="text/css">
    .r15 {
        right: 15px;
    }

    .c80 {
        color: #E1B080;
    }

    .logo {
        width: 27px;
        height: 35px;
        top: 6px;
    }

    .logo img {
        width: 100%;
        height: 100%;
    }

    .yst {
        position: relative;
    }

    .jbsr {
        background: linear-gradient(to right, rgba(29, 30, 35, 1) 0%, rgba(6, 177, 50, 0.15)) !important;
        color: #06B132 !important;
    }

    .jbsg {
        background: linear-gradient(to right, rgba(29, 30, 35, 1) 0%, rgba(230, 0, 32, 0.15));
        color: #E60020;
    }

    .kbd {
        width: 100%;
        height: 12%;
    }

    .national {
        width: 100%;
        height: 46px;
        padding: 10px 15px;
        box-sizing: border-box;
        background-color: #424242;
        position: fixed;
        top: 0px;
        left: 0px;
        z-index: 22;
    }

    .fix, .fix1 {
        width: 100%;
        position: fixed;
        top: 45px;
        left: 0px;
        z-index: 22;
    }

    .fix1 {
        background: #1d1e23;
        height: 1%;
        width: 100%;
        z-index: 21;
    }

    /*.cgree{color: #06B132;}*/
</style>
<body ms-controller="root">
    <div class="national">
                        <span class="absolute r15 mt3" ms-click="toedit">
                            <input id="edit" type=button style="background:#424242;color: #E1B080;" value="编辑" />
                        </span>
        <div class="ChooseNa w30">
            <div class="logo absolute l20">
                <img src="../img/logodz.png"/>
            </div>
            <div class="tc c80 f18">
                交易品种
            </div>
        </div>
    </div>

    <div class="fix1"></div>
    <div class="list_title f12 hidden color999 mt5 fix">
        <div class="item_name fl w50">交易品种</div>
        <div class="item_name fl w25 tr">最新价</div>
        <div class="item_name fl w25 tr">涨跌幅<span class="updown inline_block uppic" ms-class-downpic="isup" ms-click="chooseup"></span></div>
    </div>
    <div class="kbd"></div>
        <#list products as product>
            <div class="markets markets-a hidden" row-code="${product.code}" ms-class-jbsg="${product.changeCount}<0" ms-class-jbsr="${product.changeCount}>0" >
                <div class="fl w50">
                    <div class="f18 color_ef"><span class="markets_span inline_block bgcolor_red f10 mr8">${product.exchange}</span>${product.name}</div>
                    <div class="mt5 f10 colorccc"><span class="markets_span inline_block bgcolor_blu f10 mr8">主</span>
                        <#if product.code == 'SCau0001'>
                                AU1812
                        </#if>
                        <#if product.code == 'SCag0001'>
                                AG1812
                        </#if>
                        <#if product.code == 'SCcu0001'>
                                CU1807
                        </#if>
                        <#if product.code == 'DCp0001'>
                                P1809
                        </#if>
                        <#if product.code == 'SCrb0001'>
                                RB1810
                        </#if>
                        <#if product.code == 'DCi0001'>
                                I1809
                        </#if>
                        <#if product.code == 'ZCSR0001'>
                                SR1809
                        </#if>
                        <#if product.code == 'SCru0001'>
                                RU1809
                        </#if>
                        <#if product.code == 'SEsc0001'>
                                SC1809
                        </#if>
                        <#if product.code == 'CMGCA0'>
                                GC1806
                        </#if>
                        <#if product.code == 'CMHGA0'>
                                HG1807
                        </#if>
                        <#if product.code == 'NENGA0'>
                                NG1806
                        </#if>
                        <#if product.code == 'CENQA0'>
                                NQ1806
                        </#if>
                        <#if product.code == 'CEYMA0'>
                                YM1806
                        </#if>
                        <#if product.code == 'NECLA0'>
                                CL1806
                        </#if>
                    </div>
                </div>
                <div class="markets_num w25 fl f18 tr cgree" id="lastPrice-${product.code}" onchange="">${product.lastPrice}</div>
                <div class="markets_num w25 fl f18 tr cgree" id="changeCount-${product.code}">${product.changeCount}%</div>
            </div>
        </#list>
        <br />
        <br />
        <br />

        <div ms-include-src="'../fragment/footer.html'"></div>

        <script>
            var isDomestic = '${RequestParameters["isDomestic"]}';
            $(function () {
                $("#edit").click(function () {
                    window.location.href='trade/edit_market';
                });
                // isDomestic=="1"?isDomestic=1:isDomestic=0;
                // alert(isDomestic);
                $(".markets-a").click(function () {
                    window.location.href='trade/product?code='+$(this).attr("row-code");
                });
                setInterval("changeIndexData();",1000);
            });
            function changeIndexData() {
                /*$.ajax({ url: "http://dt.jctytech.com/stock.php?u=17305&market=SCau0001,SCag0001,SCcu0001,DCp0001,SCrb0001,DCi0001,ZCSR0001,SCru0001,SEsc0001,CMGCA0,CMHGA0,NENGA0,CENQA0,CEYMA0,NECLA0&type=stock", async:true, success: function(ret){
                        console.log(ret);
                    }});*/
                $.get("trade/getIndexData",{"isDomestic":isDomestic},function (data) {
                    data.forEach(function (val,i,arr) {
                        $("#lastPrice-"+val.code).html(val.lastPrice);
                        $("#changeCount-"+val.code).html(val.changeCount+"%");
                    });
                });
            }
        </script>

</body>
</html>